import Taro, {Component} from '@tarojs/taro'
import {View, Textarea} from '@tarojs/components'
import {connect} from '@tarojs/redux'

import './replycontent.scss'

class ReplyContent extends Component {
  btnOk () {
    if(this.state.value ) {
      this.props.onBtnOk && this.props.onBtnOk(this.state.value)
    }else{
      Taro.showToast({title:'请输入文字', icon: 'icon'})
    }
  }
  btnCancel () {
    this.props.onBtnCancel && this.props.onBtnCancel()
  }
  changeText (e) {
    if(e.target) {
      this.setState({
        value: e.target.value
      })
    }
  }
  render () {
    return (
      <View className='replaycontent'>
        <Textarea onInput={this.changeText.bind(this)} placeholder='请输入' />
        <View className=''>
          <Button onClick={this.btnOk.bind(this)}>确定</Button>
          <Button onClick={this.btnCancel.bind(this)} >取消</Button>
        </View>
      </View>
    )
  }
}

export default ReplyContent